package com.lrkj.back.service.impl;

import java.util.List;
import java.util.Map;

import com.lrkj.back.entity.TbAffiche;
import com.lrkj.back.mapper.TbAfficheMapper;
import com.lrkj.back.service.TbAfficheService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.com.cbons.mamisay.parent.db.api.DBInterface;
import cn.com.cbons.mamisay.parent.exception.DBException;
import cn.com.cbons.mamisay.parent.service.base.ParentServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Transactional
@Service("AfficheService")
public class TbAfficheServiceImpl extends ParentServiceImpl<TbAffiche> implements TbAfficheService {

    @Autowired
    private TbAfficheMapper afficheMap;

    @Override
    protected DBInterface<TbAffiche> getDao() throws DBException {
        // TODO Auto-generated method stub
        return afficheMap;
    }

    @Override
    public PageInfo<TbAffiche> findAllTbAffiche(Map<String, Object> map) throws DBException {
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),
                Integer.valueOf(map.get("pageSize").toString()));
        List<TbAffiche> tbList = afficheMap.findAllTbAffiche(map);
        PageInfo<TbAffiche> page = new PageInfo<TbAffiche>(tbList);
        return page;
    }

    @Override
    public List<TbAffiche> selectAllTbAffiche() throws DBException {
        // TODO Auto-generated method stub
        return afficheMap.selectAllTbAffiche();
    }

    @Override
    public List<TbAffiche> findAllTbAfficheNoPage(Map<String, Object> map) throws DBException {
        return afficheMap.findAllTbAffiche(map);
    }

    @Override
    public TbAffiche findOneAffiche(Map<String, Object> map) throws DBException {
        return afficheMap.findOneAffiche(map);
    }

}
